﻿
var pageDetail = new Sail.page({
    name     : "pagedetail",                 //定义页面对象的唯一标识 名称
    haveNavi : false,
      
    frames   : {
        name     : "frameMain",            //该frame对象的唯一标识
        title    : "配送单",                 //标题文本
         getURL : "../data/laJiChuLiUpdate.txt",
        //postURL  : "test.txt",
        //postURL : "../../DataMap?funcname=save",
        bindDataFirst : false,
        //-------------------------------------------------------------------------------
        //以JSON形式描述 frame 的构成(包含哪些 item)
        //-------------------------------------------------------------------------------
        items    : [
            {
                name  : "formDetail",
                type  : "form", 
                title : "配送单新增",
                buttons : ["保存","关闭"],
                
               "items"    : [
        {   
            type:"calendar",    
            title:"配送日期",  
            allowBlank : false,    
            dataIndex:"dataset.personalInfo.testTime" 
        },   
		{ 
			type:"combox",
			title:"下级分销商或门店",                                         
			url:"data/dangwei.txt",
			root:"dataset.simplecombobox"                
		}  ,
       { 
			type:"combox",
			title:"资金形式",                                         
			url:"data/zijingxinshi.txt",
			root:"dataset.simplecombobox"                
		}  ,
       
        {   
            type:"input",    
            title:"经手人",     
            allowBlank : false,
            dataIndex:"dataset.personalInfo.remark"
            
        },
       
        {   
            type:"input",    
            title:"备注",     
            allowBlank : true,
            dataIndex:"dataset.personalInfo.remark"
            
        }
    	],
                 "layoutConfig" : {
					        columns : 2
					    		},
    "layout" : [
        {                   
            items:[
                {'name':'配送日期'},{'name':'下级分销商或门店'}
              
            ]
        },
       
        {
            items:[
               
                {'name':'资金形式'}, {'name':'经手人'}
            ]
        },{
            items:[
              
                {'name':'备注' }
            ]
        }
    ]
            },
            {
                name      : "gridson",
                type      : "editGrid",
                title     : "配送单明细",
                bbar      : false,
                allowBlank : false,
                 haveCheckCol: false,
                 tbar : [],
                tbar      : ['新增','-','删除'],
                bindRelation   : {
                    root : "dataset.grid",
                    id    : "pid",
                    col   :[
                       {   "header":"产品名称",  		"align":"right","dataIndex":"F1",  "width":100 },
                       {   "header":"型号规格",  		"align":"right","dataIndex":"F2",  "width":100 },
                       {   "header":"供给形式",   "align":"right","dataIndex":"F3",  "width":100 },
                       {   "header":"单价",   "align":"right","dataIndex":"F3",  "width":100 },
                       {   "header":"数量",   "align":"right","dataIndex":"F3",  "width":100 },
                       {   "header":"金额",   "align":"right","dataIndex":"F3",  "width":100 }
                    ],
                    editor : [
        				             /*{
                                type : "comboBox",
                                "config":{
                                 allowBlank:false,
                                 url:"../data/ErrorType.txt"}
                             }*/
	                             { "type":"selectfield",     
							                "config":{
							                    "allowBlank": false, 
							                    openUrl     : "popWin.html",
							                    commonParameter  : {orgId: '', postId: '123', name:'',code:''},
							                    openWidth   : 1024,
							                    openHeight  : 600            
							                }},
                             {type:"numberField",config:{decimalPrecision:4,minvalue:0,allowBlank:false}},
                            {type:"numberField",config:{decimalPrecision:4,minvalue:0,allowBlank:false}},
                            {type:"numberField",config:{decimalPrecision:4,minvalue:0,allowBlank:false}},
							{type:"numberField",config:{decimalPrecision:4,minvalue:0,allowBlank:false}},
							 {type:"numberField",config:{decimalPrecision:4,minvalue:0,allowBlank:false}}
                       ]
                    
                }
            }
        ],
        businessData : {
           "dataset": {
           		"grid" : {
	                "pid": "",
	                "F1" : "",
	                "F2" : "",
	                "F3" : "",
	                 "F4" : ""
              	}
            }
        },

        bindEvent2Items : function(){  
             var frame = this;
             var obj_form =  $('formDetail');
             
             obj_form.getButton('关闭').on('click',function(){
                this.close();
             },frame);
             
             var obj_grid = $("gridson");
             
            
             
             obj_form.getButton('保存').on('click',function()
              {
                this.saveBusiness("close");
             },frame);
        }   
    }
    //进入页面自动加载数据
	
  
});

pageDetail.run();